package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstUserClientTagInfoDao;
import com.financing.wap.dto.DstUserClientTagInfoDTO;
import com.financing.wap.service.IDstUserClientTagInfoService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_user_client_tag_info  
 * 用户客户标签信息 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstUserClientTagInfoService")
public class DstUserClientTagInfoServiceImpl implements IDstUserClientTagInfoService{

	@Autowired
	private IDstUserClientTagInfoDao dstUserClientTagInfoDao;

	@Override
	public int insert(DstUserClientTagInfoDTO dstUserClientTagInfo) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstUserClientTagInfo);
		DTOdateSetUtil.setUpdateInfo(dstUserClientTagInfo);
		dstUserClientTagInfo.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstUserClientTagInfoDao.insert(dstUserClientTagInfo);
	}

	@Override
	public void update(DstUserClientTagInfoDTO dstUserClientTagInfo) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserClientTagInfo);
		dstUserClientTagInfoDao.update(dstUserClientTagInfo);
	}

	@Override
	public void updateForce(DstUserClientTagInfoDTO dstUserClientTagInfo) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserClientTagInfo);
		dstUserClientTagInfoDao.updateForce(dstUserClientTagInfo);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstUserClientTagInfoDao.delete(id);
	}
	
	@Override
	public List<DstUserClientTagInfoDTO> queryList(DstUserClientTagInfoDTO dstUserClientTagInfo) throws SQLException {
		return dstUserClientTagInfoDao.queryList(dstUserClientTagInfo);
	}

	@Override
	public int queryListCount(DstUserClientTagInfoDTO dstUserClientTagInfo) throws SQLException {
		return dstUserClientTagInfoDao.queryListCount(dstUserClientTagInfo);
	}

	@Override
	public DstUserClientTagInfoDTO loadById(Integer id) throws SQLException {
		return dstUserClientTagInfoDao.loadById(id);
	}
 	@Override
	public DstUserClientTagInfoDTO queryListGetFirst(DstUserClientTagInfoDTO dstUserClientTagInfo)
			throws SQLException {
		 List<DstUserClientTagInfoDTO> queryList = queryList(dstUserClientTagInfo);
		 if(queryList==null||queryList.size()==0){
			 return new DstUserClientTagInfoDTO();
		 }
		 return queryList.get(0);
	}
}
